home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ccrptmr / ftmrarra.frm < prev    next >
Text File  |  1998-04-28  |  7KB  |  237 lines

  1. VERSION 5.00
  2. Begin VB.Form FTmrArray 
  3.    Caption         =   "Timer Object Array"
  4.    ClientHeight    =   3615
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4215
  8.    Icon            =   "FTmrArray.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3615
  11.    ScaleWidth      =   4215
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.CommandButton cmdExit 
  14.       Cancel          =   -1  'True
  15.       Caption         =   "E&xit"
  16.       Height          =   375
  17.       Left            =   2160
  18.       TabIndex        =   13
  19.       Top             =   3120
  20.       Width           =   1275
  21.    End
  22.    Begin VB.CommandButton cmdAbout 
  23.       Caption         =   "&About"
  24.       Default         =   -1  'True
  25.       Height          =   375
  26.       Left            =   720
  27.       TabIndex        =   12
  28.       Top             =   3120
  29.       Width           =   1275
  30.    End
  31.    Begin VB.Frame Frame1 
  32.       Caption         =   "Countdown Objects:"
  33.       Height          =   2835
  34.       Index           =   1
  35.       Left            =   2160
  36.       TabIndex        =   6
  37.       Top             =   120
  38.       Width           =   1875
  39.       Begin VB.Label lblTimer 
  40.          BackColor       =   &H80000005&
  41.          BorderStyle     =   1  'Fixed Single
  42.          Caption         =   "lblTimer()"
  43.          ForeColor       =   &H80000008&
  44.          Height          =   315
  45.          Index           =   9
  46.          Left            =   180
  47.          TabIndex        =   11
  48.          Top             =   2280
  49.          Width           =   1515
  50.       End
  51.       Begin VB.Label lblTimer 
  52.          BackColor       =   &H80000005&
  53.          BorderStyle     =   1  'Fixed Single
  54.          Caption         =   "lblTimer()"
  55.          ForeColor       =   &H80000008&
  56.          Height          =   315
  57.          Index           =   8
  58.          Left            =   180
  59.          TabIndex        =   10
  60.          Top             =   1800
  61.          Width           =   1515
  62.       End
  63.       Begin VB.Label lblTimer 
  64.          BackColor       =   &H80000005&
  65.          BorderStyle     =   1  'Fixed Single
  66.          Caption         =   "lblTimer()"
  67.          ForeColor       =   &H80000008&
  68.          Height          =   315
  69.          Index           =   7
  70.          Left            =   180
  71.          TabIndex        =   9
  72.          Top             =   1320
  73.          Width           =   1515
  74.       End
  75.       Begin VB.Label lblTimer 
  76.          BackColor       =   &H80000005&
  77.          BorderStyle     =   1  'Fixed Single
  78.          Caption         =   "lblTimer()"
  79.          ForeColor       =   &H80000008&
  80.          Height          =   315
  81.          Index           =   6
  82.          Left            =   180
  83.          TabIndex        =   8
  84.          Top             =   840
  85.          Width           =   1515
  86.       End
  87.       Begin VB.Label lblTimer 
  88.          BackColor       =   &H80000005&
  89.          BorderStyle     =   1  'Fixed Single
  90.          Caption         =   "lblTimer()"
  91.          ForeColor       =   &H80000008&
  92.          Height          =   315
  93.          Index           =   5
  94.          Left            =   180
  95.          TabIndex        =   7
  96.          Top             =   360
  97.          Width           =   1515
  98.       End
  99.    End
  100.    Begin VB.Frame Frame1 
  101.       Caption         =   "Timer Objects:"
  102.       Height          =   2835
  103.       Index           =   0
  104.       Left            =   120
  105.       TabIndex        =   0
  106.       Top             =   120
  107.       Width           =   1875
  108.       Begin VB.Label lblTimer 
  109.          BackColor       =   &H80000005&
  110.          BorderStyle     =   1  'Fixed Single
  111.          Caption         =   "lblTimer()"
  112.          Height          =   315
  113.          Index           =   0
  114.          Left            =   180
  115.          TabIndex        =   5
  116.          Top             =   360
  117.          Width           =   1515
  118.       End
  119.       Begin VB.Label lblTimer 
  120.          BackColor       =   &H80000005&
  121.          BorderStyle     =   1  'Fixed Single
  122.          Caption         =   "lblTimer()"
  123.          Height          =   315
  124.          Index           =   1
  125.          Left            =   180
  126.          TabIndex        =   4
  127.          Top             =   840
  128.          Width           =   1515
  129.       End
  130.       Begin VB.Label lblTimer 
  131.          BackColor       =   &H80000005&
  132.          BorderStyle     =   1  'Fixed Single
  133.          Caption         =   "lblTimer()"
  134.          Height          =   315
  135.          Index           =   2
  136.          Left            =   180
  137.          TabIndex        =   3
  138.          Top             =   1320
  139.          Width           =   1515
  140.       End
  141.       Begin VB.Label lblTimer 
  142.          BackColor       =   &H80000005&
  143.          BorderStyle     =   1  'Fixed Single
  144.          Caption         =   "lblTimer()"
  145.          Height          =   315
  146.          Index           =   3
  147.          Left            =   180
  148.          TabIndex        =   2
  149.          Top             =   1800
  150.          Width           =   1515
  151.       End
  152.       Begin VB.Label lblTimer 
  153.          BackColor       =   &H80000005&
  154.          BorderStyle     =   1  'Fixed Single
  155.          Caption         =   "lblTimer()"
  156.          Height          =   315
  157.          Index           =   4
  158.          Left            =   180
  159.          TabIndex        =   1
  160.          Top             =   2280
  161.          Width           =   1515
  162.       End
  163.    End
  164. End
  165. Attribute VB_Name = "FTmrArray"
  166. Attribute VB_GlobalNameSpace = False
  167. Attribute VB_Creatable = False
  168. Attribute VB_PredeclaredId = True
  169. Attribute VB_Exposed = False
  170. Option Explicit
  171.  
  172. Implements ICcrpTimerNotifyEx
  173. Implements ICcrpCountdownNotifyEx
  174.  
  175. Private m_Tmr(0 To 4) As ccrpTimer
  176. Private m_Cnt(0 To 4) As ccrpCountdown
  177.  
  178. Private Const Bump As Long = 200
  179.  
  180. Private Sub cmdAbout_Click()
  181.    m_Tmr(0).About
  182. End Sub
  183.  
  184. Private Sub cmdExit_Click()
  185.    Unload Me
  186. End Sub
  187.  
  188. Private Sub Form_Load()
  189.    Dim i As Long
  190.    
  191.    For i = LBound(m_Tmr) To UBound(m_Tmr)
  192.       Set m_Tmr(i) = New ccrpTimer
  193.       With m_Tmr(i)
  194.          .EventType = TimerPeriodic
  195.          .Interval = (i + 1) * Bump
  196.          Set .NotifyEx = Me
  197.          .Stats.Frequency = 20
  198.          .Enabled = True
  199.       End With
  200.       Set m_Cnt(i) = New ccrpCountdown
  201.       With m_Cnt(i)
  202.          .Duration = 100000
  203.          .Interval = (i + 1) * Bump
  204.          Set .NotifyEx = Me
  205.          .Stats.Frequency = 20
  206.          .Tag = i + 5
  207.          .Enabled = True
  208.       End With
  209.    Next i
  210. End Sub
  211.  
  212. Private Sub Form_Unload(Cancel As Integer)
  213.    Dim i As Long
  214.    For i = LBound(m_Tmr) To UBound(m_Tmr)
  215.       m_Tmr(i).Enabled = False
  216.       Set m_Tmr(i) = Nothing
  217.       m_Cnt(i).Enabled = False
  218.       Set m_Cnt(i) = Nothing
  219.    Next i
  220. End Sub
  221.  
  222. Private Sub ICcrpCountdownNotifyEx_Tick(ByVal TimeRemaining As Long, ByVal Tmr As ccrpTimers.ccrpCountdown)
  223.    lblTimer(Tmr.Tag).Caption = " " & Format(TimeRemaining, "#,##0")
  224. End Sub
  225.  
  226. Private Sub ICcrpCountdownNotifyEx_Timer(ByVal Tmr As ccrpTimers.ccrpCountdown)
  227.    '
  228. End Sub
  229.  
  230. Private Sub ICcrpTimerNotifyEx_Timer(ByVal Milliseconds As Long, ByVal Tmr As ccrpTimers.ccrpTimer)
  231.    With Tmr
  232.       .Tag = Val(.Tag) + .Interval + Milliseconds
  233.       lblTimer((.Interval \ Bump) - 1).Caption = " " & Format(Val(.Tag), "#,##0")
  234.    End With
  235. End Sub
  236.  
  237.